home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / MODULA_2 / 2394.ZIP / M2TOOLS1.ZIP / WINDOWS.DEF < prev    next >
Text File  |  1990-08-16  |  6KB  |  160 lines

  1. DEFINITION MODULE Windows;
  2.  
  3.   FROM SYSTEM IMPORT BYTE;
  4.  
  5.   TYPE
  6.     BorderType  = (Double, Single, NoBorder);
  7.     OldDataType = ARRAY [0..3999] OF BYTE;
  8.     FRAME       = RECORD
  9.                     TopRow,
  10.                     TopCol,
  11.                     BottomRow,
  12.                     BottomCol,
  13.                     BAttribute,
  14.                     WAttribute : CARDINAL;
  15.                     WBorder    : BorderType;
  16.                     OldData    : OldDataType;
  17.                     Open       : BOOLEAN;
  18.                   END;
  19.  
  20.  
  21.  
  22.   PROCEDURE CreateWindow (VAR Window   : FRAME;
  23.                               TRow,
  24.                               TCol,
  25.                               BRow,
  26.                               BCol     : CARDINAL;
  27.                               Border   : BorderType;
  28.                               BAttrib,
  29.                               WAttrib  : CARDINAL);
  30.  
  31.     (*  A new window is created at position (TopRow,TopCol), where the origin
  32.         is (0,0).
  33.  
  34.         WAttrib is the background attribute for the window.  Used especially
  35.         when clearing the window, as a reverse clear might be required.
  36.  
  37.         If a border is not required then `NoBorder' should be entered, also,
  38.         `Blank' attribute should be entered for the border attribute (BAttrib).
  39.         Otherwise select either `Single' or `Double' for the border with the
  40.         appropriate attribute. *)
  41.  
  42.  
  43.   PROCEDURE CloseWindow (VAR Window : FRAME);
  44.  
  45.     (*  This procedure closes down a window and restores the old data to the
  46.         screen.
  47.  
  48.         It should be noted that in order for this to work properly, all the
  49.         open windows should be closed in reverse order to them being opened *)
  50.  
  51.  
  52.   PROCEDURE ClearWindow (VAR Window  : FRAME;
  53.                              Pattern : CHAR);
  54.  
  55.     (*  The selected window will be cleared.  The attribute of the clear is the
  56.         one selected in the window definition.
  57.         The area selected is the area inside the border.  If no border is
  58.         displayed, it should be imagined that there is one. *)
  59.  
  60.  
  61.   PROCEDURE WindowAt (VAR Window : FRAME;
  62.                           Row,
  63.               Col    : CARDINAL);
  64.  
  65.     (*  Positions the cursor at (Row,Col) relative to the (0,0) position of the
  66.         top left hand corner of the selected window *)
  67.  
  68.  
  69.   PROCEDURE WriteStringWrapAt (VAR Window : FRAME;
  70.                                    Row,
  71.                                    Col    : CARDINAL;
  72.                                    String : ARRAY OF CHAR);
  73.  
  74.     (*  This procedure will display a string at a local location in a window.
  75.         The top lefthand corner of the display area is (1,1).  Should there be
  76.         no border then the position (0,0) may be used.
  77.  
  78.         The text will wrap around to the next line should it exceed the line
  79.         length.  Words are not split.  Should a word be broken by the end of
  80.         the line, it is written on the next line.
  81.  
  82.         Should the string pass beyond the bottom of the window, it is not all
  83.         displayed.
  84.  
  85.         Any attributes required for the text displayed should be set from
  86.         the ScreenHandler module.
  87.  
  88.         e.g. to display text in Bold, you should import SetBold *)
  89.  
  90.  
  91.   PROCEDURE WriteStringAt (VAR Window : FRAME;
  92.                                Row,
  93.                                Col    : CARDINAL;
  94.                                String : ARRAY OF CHAR);
  95.  
  96.     (* Writes string at position (Row, Col) in Window *)
  97.  
  98.  
  99.   PROCEDURE WriteCharAt (VAR Window : FRAME;
  100.                              Row,
  101.                              Col    : CARDINAL;
  102.                              Char   : CHAR);
  103.  
  104.     (* Writes character Char at position (Row, Col) in Window *)
  105.  
  106.  
  107.  
  108.   PROCEDURE WriteStringCentre (VAR Window : FRAME;
  109.                                    Row    : CARDINAL;
  110.                                    String : ARRAY OF CHAR);
  111.  
  112.     (* The same attribute conditions also apply as for WriteStringAt *)
  113.  
  114.  
  115.   PROCEDURE WriteCentreExSpaces (VAR Window : FRAME;
  116.                                      Row    : CARDINAL;
  117.                                      String : ARRAY OF CHAR);
  118.  
  119.     (*  Same a WriteStringCentre except no spaces are displayed before and
  120.         after the string. *)
  121.  
  122.  
  123.   PROCEDURE WriteTitle (VAR Window : FRAME;
  124.                             Row    : CARDINAL;
  125.                             String : ARRAY OF CHAR);
  126.  
  127.     (* The same attribute conditions also apply as for WriteStringAt *)
  128.  
  129.  
  130.   PROCEDURE WriteCardAt (VAR Window : FRAME;
  131.                              Row,
  132.                              Col,
  133.                              Card,
  134.                              Width  : CARDINAL);
  135.  
  136.     (*  This procedure will write a cardinal at (Row, Col) in the selected
  137.         window - similar to WriteCard from InOut *)
  138.  
  139.  
  140.   PROCEDURE WriteIntAt (VAR Window : FRAME;
  141.                             Row,
  142.                             Col    : CARDINAL;
  143.                             Int    : INTEGER;
  144.                             Width  : CARDINAL);
  145.  
  146.     (*  This procedure will write an integer at (Row, Col) in the selected
  147.         window *)
  148.  
  149.  
  150.   PROCEDURE WriteLongIntAt (VAR Window  : FRAME;
  151.                                 Row,
  152.                                 Col     : CARDINAL;
  153.                                 LongInt : LONGINT;
  154.                                 Width   : CARDINAL);
  155.  
  156.     (*  This procedure will write a LONGINT at (Row, Col) in the selected
  157.         window *)
  158.  
  159.  
  160. END Windows.